package org.arclib.x.gui.widgets;

import java.io.IOException;

import org.arclib.ResourceLoader;
import org.arclib.Texture;
import org.arclib.draw.Draw;
import org.arclib.math.Point;

public class Image extends Widget
{
	/// load widget based on image
	public Image(String argFullPath) throws IOException
	{
		load(argFullPath); 
	}

	/// load image 
	public void load(String argFullPath) throws IOException
	{
		texture = ResourceLoader.getTexture(argFullPath);
		setSize(texture.getSize());
	}

	/// draw image from position + parent position  
	public void draw(Point parentPos)
	{
		Draw.imageBottomLeft(texture, position.add(parentPos), size, color); 
	}

  private Texture texture; 
}
